<!DOCTYPE HTML>
<html>
	<head>
		<meta charset="utf-8"/>
		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=3.0, user-scalable=yes"/>
		<meta name="HandheldFriendly" content="true"/>
		<meta name="MobileOptimized" content="320"/>
		<title>图片查看</title>
		<link rel="stylesheet" href="../css.min/mui.min.css" />
		<style type="text/css" media="screen">
			img {
				vertical-align: middle;
			}
			a{
				position: absolute;
				top: 4px;
				left: 4px;
				color: white;
			}
		</style>
	</head>
	<body style="text-align:center;background:#000000;">
		<img id="img" onclick="mui.back();" onload="imgLoaded();" onerror="imgError();"/>
	</body>
	<script type="text/javascript" src="../js.min/mui.min.js" ></script>
	<script type="text/javascript">
			var w=null;
			// H5 plus事件处理
			function plusReady(){
				w=plus.nativeUI.showWaiting();
			}
			if(window.plus){
				plusReady();
			}else{
				document.addEventListener("plusready",plusReady,false);
			}
			
			function imgLoaded() {
				w&&(w.close(),w=null);
				var b = document.body;
				var img = document.getElementById("img");
				var pb = b.clientHeight/b.clientWidth,
				pi = img.clientHeight/img.clientWidth;
				if ( pb > pi ) {
					img.style.width = "100%";
				} else {
					img.style.height = "100%";
				}
				b.style.lineHeight = b.clientHeight+"px";
			}
			
			function imgError(){
				w&&(w.close(),w=null);
				document.getElementById("img").style.display = "none";
				plus.nativeUI.alert( "无效的图片资源", function(){
					mui.back();
				} );
			}
			
			function loadMedia(src){
				document.getElementById("img").src=src;
			}
			
	</script>
</html>